package org.boulderfoodrescue.webapp.client.dialogs.confirm;

import org.boulderfoodrescue.webapp.client.dialogs.DialogCallback;

import com.google.gwt.user.client.ui.DialogBox;

public class ConfirmDialog extends DialogBox implements DialogCallback{

  private ConfirmDialogView dialogView;
  private DialogCallback confirmationCallback;
  
  public ConfirmDialog(String confirmationText, DialogCallback confirmationCallback)
  {
    this.confirmationCallback = confirmationCallback;
    dialogView = new ConfirmDialogView(this);
    dialogView.setText(confirmationText);
    this.add(dialogView);
    this.setGlassEnabled(true);
    //this.setAnimationEnabled(true);
  }
  
  @Override
  public void onCancelOperation() {
    hide();
    confirmationCallback.onCancelOperation();
  }

  @Override
  public void onConfirmOperation() {
    hide();
    confirmationCallback.onConfirmOperation();
  }

}
